<?
if (!defined('SMF'))
	die('Hacking attempt...');

global $smcFunc, $txt, $scripturl, $user_info;
global $dbtables;

// Check if user already has a BNT account
$result = $smcFunc['db_query']('', '
	SELECT *
	FROM {raw:db_ships}
	WHERE user_id = {int:user_id}
	LIMIT 1',
	array(
		'db_ships' => $dbtables['ships'],
		'user_id' => $user_info['id'],
	)
);

// If the user already has an account, run the pre-login checks
if ($smcFunc['db_num_rows']($result) <> 0)
{
	$smcFunc['db_free_result']($result);
	TextMainMenu();
	redirectexit('action=blacknova;sa=main');
}
else
{
	echo '
					<div id="newplayer_frame">
						<div class="overlay"></div>
						<div id="newplayer_content">
							<h2>', $txt['bnt_new_title'], '</h2>
							<form id="newplayerform" action="', $scripturl, '?action=blacknova;sa=createplayer2" method="post">
								<p><label for="character_name">', $txt['bnt_new_character_name'], '</label><input type="text" id="character_name" name="character_name" size="20" maxlength="40" tabindex="1" value="" /></p>
								<p><label for="ship_name">', $txt['bnt_new_ship_name'], '</label><input type="text" id="ship_name" name="ship_name" size="20" maxlength="40" tabindex="2" value="" /></p>
								<div class="newplayerspacer"><input type="submit" value="', $txt['bnt_submit'], '" class="" /></div>
							</form>
							<ul>
								<li><a href="', $scripturl, '?action=blacknova;sa=ranking">', $txt['bnt_rankings'], '</a></li>
								<li><a href="', $scripturl, '?action=blacknova;sa=settings">', $txt['bnt_settings'], '</a></li>
							</ul>
						</div>
					</div>
					<script>
						$(\'.rounded\').corners();
					</script>';
}
?>
